UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K2HT5Z/O+S2Qm9eHCTGQJEeldGEk/dnz68Ew8xCoWwU=' 
WHERE 
  key_id = 'b93a711d7f06e70e97bba9c503bca562d4428737827132d6d9ec8d5ca222154a' 
  AND (
    token = 'K2HT5Z/O+S2Qm9eHCTGQJEeldGEk/dnz68Ew8xCoWwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025