UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w4CT1+/l2i1XqfODP5vtEQqxYj1Ml3YJZGvisoQrTiQ=' 
WHERE 
  key_id = 'cb27586f6f6683504aac65471a5d065d4114ad1892880f894f4f00cbaaeceed5' 
  AND (
    token = 'w4CT1+/l2i1XqfODP5vtEQqxYj1Ml3YJZGvisoQrTiQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034