UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R3s5btsJjJ+ohbxwoAaaQcW+Hl1J66vt/J0BtIfF4nE=' 
WHERE 
  key_id = '48933223841385d42e8a2f33d370433dbd8facae50f57cd86bd6271be24da95b' 
  AND (
    token = 'R3s5btsJjJ+ohbxwoAaaQcW+Hl1J66vt/J0BtIfF4nE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031