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

Query time 0.00048