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

Query time 0.00030