UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kwm33QHJIFe+km5hkfeHv/5dnQFugY2gYPemWcZ8734=' 
WHERE 
  key_id = '6d7e1277caf1cddd36aeed02cf4f7ee4d0556a26254f99016d1952a28d957263' 
  AND (
    token = 'kwm33QHJIFe+km5hkfeHv/5dnQFugY2gYPemWcZ8734=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040