UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A7xnYHZw9FNEHvimXoQxch4Oq30s3FPjVTmXCH0LYAQ=' 
WHERE 
  key_id = 'bc645a95588b0a9545a90125bf61febfd2d14a22e02c811aa6fc1e0f28f33518' 
  AND (
    token = 'A7xnYHZw9FNEHvimXoQxch4Oq30s3FPjVTmXCH0LYAQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026