UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nDWhqZF7I5W2O6I0384RFuWVKMTv6Haeh9ir1AtK7LU=' 
WHERE 
  key_id = '1a7054cf06d5c14f3f7bde54983186e5d672faec963f06dd1b5ea632fe68d1ad' 
  AND (
    token = 'nDWhqZF7I5W2O6I0384RFuWVKMTv6Haeh9ir1AtK7LU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029