UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oAdv1rcOCkba/relV1dVB6mOjm+NigapSW7HWjHI8B8=' 
WHERE 
  key_id = '5380af002c49a5d437f10d4f7eef0291a706c74559a0acca3e20fdb93a62f0c3' 
  AND (
    token = 'oAdv1rcOCkba/relV1dVB6mOjm+NigapSW7HWjHI8B8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036