UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dAx5RPU1PAbdT5bqfaFdJOpuFc7WzFnejFfQykoFdcc=' 
WHERE 
  key_id = '5385b288d71e01bcb6473077c401ea9547e7c52c509399800119b0d737fb1a4f' 
  AND (
    token = 'dAx5RPU1PAbdT5bqfaFdJOpuFc7WzFnejFfQykoFdcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027