UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HpslecuRWih0CKXERnZFEaeHCucqX3eqq8dma6PIZUM=' 
WHERE 
  key_id = 'e06e34dc420061f6771996480dc34a096ecbb225bf95b5ca5da3ee12fe25502b' 
  AND (
    token = 'HpslecuRWih0CKXERnZFEaeHCucqX3eqq8dma6PIZUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041