UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GuXBPfS25jhv7PmO884rHKQB/EqNZYjU0OXFZb4Dstw=' 
WHERE 
  key_id = '1e247afc242a544b10fe5313d7b283f212973264dc1eed1e5d8fb560c4d76222' 
  AND (
    token = 'GuXBPfS25jhv7PmO884rHKQB/EqNZYjU0OXFZb4Dstw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049