UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6DKdA9Nd2xy/a5VpM6x12yWN3f7Y7EaZ85HTu4P/Yo4=' 
WHERE 
  key_id = '0500565ec889d6628d435ff60c2a62bc15758453a734559781768f96161dfabf' 
  AND (
    token = '6DKdA9Nd2xy/a5VpM6x12yWN3f7Y7EaZ85HTu4P/Yo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025