UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YDCQ4ShqrsEArQsoJ0kEwQpu5vwYXqqjVmsrqSCGzYE=' 
WHERE 
  key_id = '36e58ee22e00e3f98bb3d0ea04c8711422e49e4887c3fdef41aa6b19d43063ee' 
  AND (
    token = 'YDCQ4ShqrsEArQsoJ0kEwQpu5vwYXqqjVmsrqSCGzYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037