UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bKMoeb+9ccFjWkfn2wpUPNXrN2dYiTqvpeebt42xjFY=' 
WHERE 
  key_id = 'f131790a1fd914fb6aa2ef5aa6db39c493725db42a01c2409139108b053453b7' 
  AND (
    token = 'bKMoeb+9ccFjWkfn2wpUPNXrN2dYiTqvpeebt42xjFY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043