UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Er/4H8em0Lg22CcEbu39jCCYeBWNod25nhQZaOLo1rw=' 
WHERE 
  key_id = '2663ef4686b106e2ce36ba137abc36e2c12e705c59930cdb01dd9248f5156f94' 
  AND (
    token = 'Er/4H8em0Lg22CcEbu39jCCYeBWNod25nhQZaOLo1rw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038