UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EUT/dQ87BWMHh1z2AalEPrc7xQHThvE3ogLhb8SIeK8=' 
WHERE 
  key_id = '9516da078d4631567e7654a48336b09da5b4e28d1211b2c4eebc17d736699603' 
  AND (
    token = 'EUT/dQ87BWMHh1z2AalEPrc7xQHThvE3ogLhb8SIeK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045