UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hxKJ8HOpBnHhddw2zthQTgOLau9l6G//VSTMKthF+iw=' 
WHERE 
  key_id = '894488fe40bbb9b4e65e591874212789a09bb2b3473501b8b95b4f62e21de80b' 
  AND (
    token = 'hxKJ8HOpBnHhddw2zthQTgOLau9l6G//VSTMKthF+iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034